package config_center

import (
	clientv3 "go.etcd.io/etcd/client/v3"
	"payme3000/framework/db"
)

// GetEtcd 返回etcd的连接实例
func (c *ConfigCenter) GetEtcd(dbType db.Type) *clientv3.Client {
	etcdDb := db.GetEtcd(dbType)
	if etcdDb != nil {
		return etcdDb
	}

	if err := c.initDb(dbType); err != nil {
		return nil
	}

	return db.GetEtcd(dbType)
}
